package com.baiyang.server.model.book;

import com.baiyang.server.annotation.NotNull;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author XVX - generator
 * @version 1
 */
@NotNull
public class Purchase {
	//唯一id
	@NotNull
	private String id;	
	//创建时间
	private String createTime;	
	//创建人
	@NotNull
	private String createBy;
	private String createName;
	//是否有效：1-有效，0-无效
	private String available = "1";
	//进货总花费
	private BigDecimal totalCost;
	private List<PurchaseDetail> records;
	
	public String getId(){
		return id;
	}
	public void setId(String id){
		this.id = id;
	}
	public String getCreateTime(){
		return createTime;
	}
	public void setCreateTime(String createTime){
		this.createTime = createTime;
	}
	public String getCreateBy(){
		return createBy;
	}
	public void setCreateBy(String createBy){
		this.createBy = createBy;
	}
	public String getAvailable(){
		return available;
	}
	public void setAvailable(String available){
		this.available = available;
	}
	public BigDecimal getTotalCost(){
		return totalCost;
	}
	public void setTotalCost(BigDecimal totalCost){
		this.totalCost = totalCost;
	}
	public void addTotalCost(double total){
		if(this.totalCost == null){
			this.totalCost = new BigDecimal("0");
		}
		this.totalCost = this.totalCost.add(BigDecimal.valueOf(total));
	}
	public List<PurchaseDetail> getRecords() {
		return records;
	}

	public void setRecords(List<PurchaseDetail> records) {
		this.records = records;
	}

	public String getCreateName() {
		return createName;
	}

	public void setCreateName(String createName) {
		this.createName = createName;
	}
}
